//导入request.js
import request from '@/utils/request.js'

//注册
export const registerService = (registerData)=>{
    const params = new URLSearchParams();
    for(let key in registerData){
        params.append(key,registerData[key])
    }
    return request.post('/emp/register',params)
}

//登录
export const loginService = (loginData)=>{
    const params = new URLSearchParams();
    for(let key in loginData){
        params.append(key,loginData[key])
    }
    return request.post('/emp/login',params)
}

//获取个人信息
export const getEmpInfoService = ()=>{
    return request.get('/emp/empInfo')
}

//修改基本信息
export const updateEmpInfoService = (empInfo)=>{
    return request.put('/emp/update',empInfo)
}

//修改头像
export const updateEmpAvatarService = (avatarUrl)=>{
    let params = new URLSearchParams();
    params.append('avatarUrl',avatarUrl)
    return request.patch('/emp/updateAvatar',params)
}

//修改密码
export const updateEmpPwdService = (pwd)=>{
    return request.patch('/emp/updatePwd',pwd)
}

//生成验证码
export const generateService = ()=>{
    return request.get('/emp/generate')
}
